home *** CD-ROM | disk | FTP | other *** search
/ Tate Gallery - Exploring Modern Art / Tate Gallery - Exploring Modern Art.iso / install / setup.mst / setup.bin
Text File  |  1994-07-24  |  19KB  |  643 lines

  1. '**************************************************************************
  2. '*                      Attica Installation Program
  3. '*      D.K. 13/8/92    - modified from SAMPLE1.MST
  4. '*    JMS  12/1/94
  5. '**************************************************************************
  6.  
  7. '' *** $DEFINE DEBUG  ''Define for script development/debugging
  8. ''$DEFINE DEBUG
  9.  
  10. '$INCLUDE 'setupapi.inc'
  11. '$INCLUDE 'msdetect.inc'
  12. '$INCLUDE 'myfuncts.inc'
  13.  
  14. ''Dialog ID's
  15. CONST WELCOME       = 100
  16. CONST ASKQUIT       = 200
  17. CONST DESTPATH      = 300
  18. CONST EXITFAILURE   = 400
  19. CONST EXITQUIT      = 600
  20. CONST EXITSUCCESS   = 700
  21. CONST OPTIONS       = 800
  22. CONST APPHELP       = 900
  23. CONST BADPATH       = 6400
  24.  
  25. ''Attica specific Dialog ID's
  26. CONST SINGLE_ID        = 1000
  27. CONST ADMIN_ID         = 1001
  28. CONST NETWORK_ID       = 1002
  29.  
  30.  
  31. GLOBAL WINDIR$        ''Windows Directory
  32. GLOBAL SYSDIR$        ''System Directory
  33. GLOBAL DEST$        ''destination directory.
  34. GLOBAL SOURCE$      ''Source Directory
  35. GLOBAL TITLE$       ''Title of dialog box
  36. GLOBAL COPYRIGHT$   ''Copyright string
  37. GLOBAL ROMDRIVE$
  38. GLOBAL HIDECD$        ''"TRUE" means hide cd-drive in single user installation
  39. GLOBAL ADDPATH$     ''"ON" or "OFF"
  40. GLOBAL ADDGROUP$    ''"ON" or "OFF"
  41. GLOBAL NEWGROUP$    ''group to add to program manager
  42. GLOBAL ITEMEXE$     ''the .exe file to be executed
  43. GLOBAL TEMPDIR$      ''where the setup files are
  44.  
  45. GLOBAL INFO$        '' which section of setup.ini to read
  46. GLOBAL INF_FILE$    '' name of setup .inf file to use
  47. GLOBAL DLGPROC$     ''  which dialog procedure to call
  48. GLOBAL DLG_ID%      ''  which dialog box to use
  49.  
  50. GLOBAL INSMODE$     '' Installation mode
  51. GLOBAL INIFILES$    '' .ini files those require changes
  52. GLOBAL Ini$            '' Full path for temporary setup.ini 
  53. GLOBAL BACKGROUND$    '' Dll contains Background bitmap 
  54. GLOBAL SUBDIR$        '' Subdirectories after Dest directory
  55.  
  56. CONST  VAR_MAX% = 5
  57. GLOBAL VarNames$(VAR_MAX%)     '' 1 -- Variable names
  58. GLOBAL VarValues$(VAR_MAX%)     '' 2 -- Sub. Strings
  59.  
  60. DECLARE SUB      Install
  61. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  62. DECLARE SUB      AddSectFilesToCopyList (szSect$, szSrc$, szDest$)
  63. DECLARE FUNCTION InitializeInstall LIB "mscuistf.dll" ( hInst%, hWnd% ) AS INTEGER
  64. DECLARE FUNCTION SubVariables( szString$ ) AS STRING
  65.  
  66. DECLARE FUNCTION audioInstalled     LIB "mscuistf.dll" ( ) AS INTEGER
  67. DECLARE FUNCTION audioOpenSession     LIB "mscuistf.dll" ( szSession$, bEdit% ) AS INTEGER
  68. DECLARE FUNCTION audioCloseSession     LIB "mscuistf.dll" ( hSession% ) AS INTEGER
  69. DECLARE FUNCTION audioOpenFile         LIB "mscuistf.dll" ( hSession%, szFileName$ ) AS INTEGER
  70. DECLARE FUNCTION audioCloseFile     LIB "mscuistf.dll" ( hSession%, hAudio% ) AS INTEGER
  71. DECLARE FUNCTION audioPlayFile         LIB "mscuistf.dll" ( hSession%, hAudio%, CallBack& ) AS INTEGER
  72. DECLARE FUNCTION audioStopFile         LIB "mscuistf.dll" ( hSession%, hAudio%, CallBack& ) AS INTEGER
  73. DECLARE FUNCTION audioRewindFile    LIB "mscuistf.dll" ( hSession%, hAudio%, CallBack& ) AS INTEGER
  74.  
  75.  
  76. INIT:
  77.  
  78.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  79.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  80.  
  81.     ret% = InitializeInstall (hinstFrame(), HwndFrame())        ''max window
  82.  
  83.     TEMPDIR$ = GetSymbolValue("STF_SRCINFPATH")
  84.         
  85.     IF TEMPDIR$ = "" THEN
  86.             TEMPDIR$ = GetSymbolValue("STF_CWDDIR")
  87.     END IF
  88.  
  89.  
  90. ''*******************************************************
  91. ''  set up mode dependant info - single, admin or network:
  92. ''  STF_MODE$ is initialised by _mstest from the command line options
  93. ''*******************************************************
  94.  
  95.     INSMODE$ = GetSymbolValue("STF_MODE")
  96.  
  97.     SELECT CASE INSMODE$
  98.       
  99.       CASE "NETWORK"
  100.         INFO$ = "Info Net"
  101.         ADDPATH$ = "OFF"
  102.         ADDGROUP$ = "ON"
  103.         GetLocalHardDrivesList "Drives"
  104.         DLGPROC$  = "NetInstallDlgProc"
  105.         DLG_ID% = NETWORK_ID
  106.  
  107.       CASE "ADMIN"
  108.         INFO$ = "Info Admin"
  109.         ADDPATH$ = "OFF"
  110.         ADDGROUP$ = "OFF"
  111.         GetNetworkDrivesList "Drives"
  112.         DLGPROC$  = "AdminInstallDlgProc"
  113.         DLG_ID% = ADMIN_ID
  114.  
  115.       CASE ELSE
  116.         INFO$ = "Info Single"
  117.         ADDPATH$ = "ON"
  118.         ADDGROUP$ = "ON"
  119.         GetLocalHardDrivesList "Drives"
  120.         DLGPROC$  = "SingleInstallDlgProc"
  121.         DLG_ID% = SINGLE_ID
  122.         INSMODE$ = "SINGLE"
  123.     END SELECT
  124.  
  125.  
  126. ''*******************************************************
  127. ''  READ FROM SETUP.INI : product-dependent names
  128. ''*******************************************************
  129.  
  130.  Ini$ = TEMPDIR$ + "setup.ini"
  131.     WINDIR$      = GetWindowsDir()
  132.     SYSDIR$      = GetWindowsSysDir()
  133.         NEWGROUP$ = GetIniKeyString( Ini$, INFO$, "GroupName" )
  134.         ITEMEXE$  = GetIniKeyString( Ini$, INFO$, "ExeFiles" )
  135.         INF_FILE$ = GetIniKeyString( Ini$, INFO$, "InfFile" )
  136.     INIFILES$ = GetIniKeyString( Ini$, INFO$, "IniFiles" )
  137.     HIDECD$   = GetIniKeyString( Ini$, INFO$, "HideCD" )
  138.     SUBDIR$   = GetIniKeyString( Ini$, INFO$, "SubDir" )
  139.  
  140. ''*******************************************************
  141. ''  Set background bitmap:
  142. ''*******************************************************
  143.  
  144.     BACKGROUND$ = GetIniKeyString( Ini$, INFO$, "BkFile" )
  145.     
  146.     IF BACKGROUND$ = "" THEN 
  147.         BACKGROUND$ = CUIDLL$
  148.     LOGO% = 108
  149.     ELSE 
  150.     LOGO% = 1    
  151.     ENDIF
  152.  
  153.     SetBitmap BACKGROUND$, LOGO%
  154.  
  155. ''*******************************************************
  156. '' default entries for the main dialog box:
  157. ''*******************************************************
  158.  
  159.     IF INSMODE$ = "NETWORK" THEN
  160.     DEST$ = WINDIR$
  161.      ELSE
  162.     DEST$ = GetListItem("Drives", 1) + ":\" + GetIniKeyString( Ini$, INFO$, "DestDir" )
  163.     END IF
  164.  
  165.     SOURCE$ = GetSymbolValue( "STF_SRCDIR" )
  166.     ROMDRIVE$ = GetRomDrive
  167.     TITLE$ = GetIniKeyString( Ini$, INFO$, "Title" )
  168.     SetTitle TITLE$
  169.     COPYRIGHT$ = GetIniKeyString( Ini$, INFO$, "Copyright1" )
  170.     COPYRIGHT$ = COPYRIGHT$+CHR$(10)+GetIniKeyString( Ini$, INFO$, "Copyright2" )
  171.     COPYRIGHT$ = COPYRIGHT$+CHR$(10)+GetIniKeyString( Ini$, INFO$, "Copyright3" )
  172.  
  173. ''********************************************************
  174. '' DEBUG
  175. ''********************************************************
  176.  
  177. '$IFDEF DEBUG
  178.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  179.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  180.     IF IsDriveValid(WinDrive$) = 0 THEN
  181.         i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  182.         GOTO QUIT
  183.     END IF
  184. '$ENDIF ''DEBUG
  185.  
  186. ''***************************************************************
  187. ''READ FILES OUT OF INF FILE LIST
  188. ''***************************************************************
  189.  
  190.     szInf$ = TEMPDIR$ + INF_FILE$
  191.     ReadInfFile szInf$
  192.  
  193.     SetSymbolValue "Title", TITLE$
  194.     SetSymbolValue "Copyright", COPYRIGHT$
  195.     SetSymbolValue "SourcePath", SOURCE$
  196.     SetSymbolValue "DestPath", DEST$
  197.     SetSymbolValue "RomDrive", ROMDRIVE$
  198.     SetSymbolValue "AddPath", ADDPATH$
  199.     SetSymbolValue "AddGroup", ADDGROUP$
  200.     SetSymbolValue "HideRomDrive", HIDECD$
  201.  
  202. '' welcome box
  203. WELCOME:
  204.     
  205.   
  206.     sz$ = UIStartDlg(CUIDLL$, 100, "FInfodlgProc", 900, "FHelpDlgProc") 
  207.  
  208.     UIPop 1
  209.     if sz$ = "EXIT" then
  210.        GOSUB ASKQUIT
  211.     end if
  212.  
  213.     sz$ = UIStartDlg(CUIDLL$, DLG_ID%, DLGPROC$, 0, "" )
  214.         UIPop 1
  215.     IF sz$ = "CANCEL" THEN
  216.         GOSUB ASKQUIT
  217.         GOTO WELCOME
  218.     END IF
  219.  
  220.     
  221.     SOURCE$ = GetSymbolValue( "SourcePath" )
  222.     DEST$ = GetSymbolValue( "DestPath" )
  223.     ROMDRIVE$ = GetSymbolValue( "RomDrive" )
  224.     ADDPATH$ = GetSymbolValue( "AddPath" )
  225.     ADDGROUP$ = GetSymbolValue( "AddGroup" )
  226.  
  227.     RemoveSymbol "Title"
  228.     RemoveSymbol "Copyright"
  229.     RemoveSymbol "SourcePath"
  230.     RemoveSymbol "DestPath"
  231.     RemoveSymbol "RomDrive"
  232.     RemoveSymbol "AddPath"
  233.     RemoveSymbol "AddGroup"
  234.  
  235.  
  236.  AddToBillboardList CUIDLL$, 5000, "FModelessDlgProc", 10
  237.  
  238.     
  239.        Install
  240.  
  241.     UIPop 1
  242.  
  243.  
  244. ''*******************************************************
  245.  
  246. QUIT:
  247.     ON ERROR GOTO ERRQUIT
  248.  
  249.     IF ERR = 0 THEN
  250.         dlg% = EXITSUCCESS
  251.     ELSEIF ERR = STFQUIT THEN
  252.         dlg% = EXITQUIT
  253.     ELSE
  254.         dlg% = EXITFAILURE
  255.     END IF
  256.  
  257. QUITL1:
  258.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  259.     IF sz$ = "REACTIVATE" THEN
  260.         GOTO QUITL1
  261.     END IF
  262.     UIPop 1
  263.  
  264.     END
  265.  
  266. ERRQUIT:
  267.     i% = DoMsgBox("Setup sources were corrupted, call (0865) 791346", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  268.     END
  269.  
  270. BADPATH:
  271.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  272.     IF sz$ = "REACTIVATE" THEN
  273.         GOTO BADPATH
  274.     END IF
  275.     UIPop 1
  276.     RETURN
  277.  
  278. ASKQUIT:
  279.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  280.  
  281.     IF sz$ = "EXIT" THEN
  282.         UIPopAll
  283.         ERROR STFQUIT
  284.     ELSEIF sz$ = "REACTIVATE" THEN
  285.         GOTO ASKQUIT
  286.     ELSE
  287.         UIPop 1
  288.     END IF
  289.     RETURN
  290.  
  291.  
  292.  
  293.  
  294. SUB Install STATIC
  295.  
  296. '************************************************************************
  297. '** Purpose:
  298. '**     Builds the copy list and performs all installation operations.
  299. '*************************************************************************
  300.  
  301.  
  302.     CreateDir DEST$, cmoNone
  303. '$IFDEF DEBUG
  304.     OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
  305.     WriteToLogFile ""
  306.     WriteToLogFile "  User chose as destination directory: '" + DEST$ + "'"
  307.     WriteToLogFile ""
  308.     WriteToLogFile "May have had to create the directory: " + DEST$
  309.     WriteToLogFile ""
  310. '$ENDIF ''DEBUG
  311.  
  312.  
  313. ''************************************************************************
  314. '' ****  Initialize Sub. Variables 
  315. ''************************************************************************
  316.  
  317.     VarNames$( 0 ) = "[ROMDRIVE]" 
  318.     VarValues$( 0 ) = ROMDRIVE$
  319.  
  320.     VarNames$( 1 ) = "[DEST]"      
  321.     
  322.         IF INSMODE$ = "SINGLE" THEN
  323.         VarValues$( 1 ) = DEST$
  324.         ELSE
  325.         VarValues$( 1 ) = SOURCE$
  326.         END IF
  327.  
  328.     VarNames$(2) = "[SOURCE]"      
  329.     VarValues$(2) = SOURCE$
  330.     VarNames$(3) = "[WINDIR]"      
  331.     VarValues$(3) = WINDIR$
  332.     VarNames$(4) = "[SYSDIR]"      
  333.     VarValues$(4) = SYSDIR$
  334.  
  335.  
  336. '' *************************
  337. '' get files to copy
  338. ''**************************
  339.  
  340.     IF INSMODE$ = "SINGLE" THEN
  341.         Win$ = WINDIR$
  342.         Sys$ = SYSDIR$
  343.     ELSEIF INSMODE$ = "ADMIN" THEN
  344.         Win$ = DEST$
  345.         Sys$ = DEST$
  346.     ELSE
  347.     Win$ = DEST$
  348.     Sys$ = SYSDIR$
  349.     END IF
  350.  
  351. '$ifdef DEBUG
  352.     WriteToLogFile "Directories (Dest,Win,Sys): "+DEST$+", "+Win$+", "+Sys$
  353. '$endif ''DEBUG
  354.  
  355.  
  356. ''****************************************************
  357. '' copy Network files -- Single, Admin or Network mode
  358. ''****************************************************
  359.  
  360.     AddSectFilesToCopyList "Network Files", SOURCE$, DEST$
  361.     AddSectFilesToCopyList "Network Win Files", SOURCE$, Win$
  362.     AddSectFilesToCopyList "Network Sys Files", SOURCE$, Sys$
  363.  
  364. ''****************************************************
  365. '' copy Single user files -- Single or Admin mode only
  366. ''****************************************************
  367.  
  368.     IF INSMODE$ = "SINGLE" OR INSMODE$ = "ADMIN" THEN
  369.  
  370.         AddSectFilesToCopyList "Single Files", SOURCE$, DEST$
  371.         AddSectFilesToCopyList "Single Win Files", SOURCE$, Win$
  372.         AddSectFilesToCopyList "Single Sys Files", SOURCE$, Sys$
  373.  
  374.     ''**************************
  375.     '' copy Sub-directories
  376.     ''**************************
  377.  
  378.         count% = 1
  379.         subcur$ = GetNthFieldFromIniString( SUBDIR$, count% )
  380.  
  381.         WHILE subcur$ <> ""
  382.  
  383.             AddSectFilesToCopyList "Single " + subcur$ + " Files", SOURCE$, DEST$ + subcur$ + "\"
  384.             count% = count% + 1
  385.             subcur$ = GetNthFieldFromIniString( SUBDIR$, count% )
  386.  
  387.         WEND
  388.  
  389.     END IF
  390.  
  391. ''************************************
  392. '' copy Admin files -- Admin mode only
  393. ''************************************
  394.  
  395.     IF INSMODE$ = "ADMIN" THEN
  396.  
  397.         AddSectFilesToCopyList "Admin Files", SOURCE$, DEST$
  398.         AddSectFilesToCopyList "Admin Win Files", SOURCE$, Win$
  399.         AddSectFilesToCopyList "Admin Sys Files", SOURCE$, Sys$
  400.     END IF
  401.  
  402. ''**************************
  403. '' copy files
  404. ''**************************
  405.  
  406.     SetCopyGaugePosition 20, 175
  407.     CopyFilesInCopyList
  408.     ClearCopyList
  409.  
  410. ''*******************************************
  411. ''  modify .ini files to subsitute variables
  412. ''*******************************************
  413.  
  414. IF INSMODE$ <> "ADMIN" THEN
  415.    count%  = 1
  416.    inicur$ = GetNthFieldFromIniString( INIFILES$, count% )
  417.  
  418.     WHILE inicur$ <> "" 
  419.  
  420. '$ifdef DEBUG
  421.   WriteToLogFile "Ini File: " + inicur$ + " of " + INIFILES$
  422. '$endif ''DEBUG
  423.  
  424.        index% = 1
  425.        inikeys$ = GetIniKeyString( Ini$, INFO$, inicur$ + Str$(index%) )
  426.         
  427. '$ifdef DEBUG
  428.   WriteToLogFile "Getting " + inicur$ + Str$(index%)
  429. '$endif ''DEBUG
  430.  
  431.        WHILE inikeys$ <> "" 
  432.  
  433. '$ifdef DEBUG
  434.     WriteToLogFile inicur$ + Str$(index%) + " = " + inikeys$
  435. '$endif ''DEBUG
  436.  
  437.         section$ = GetNthFieldFromIniString( inikeys$, 1 )
  438.             IF section$ <> "" THEN
  439.  
  440.                    keycount% = 2
  441.             keycur$ = GetNthFieldFromIniString( inikeys$, keycount% )
  442.  
  443.                WHILE keycur$ <> ""
  444.  
  445.                 keyval$ = GetIniKeyString( WINDIR$ + inicur$, section$, keycur$ )
  446.                   IF keyval$ <> "" THEN
  447.                         
  448. '$ifdef DEBUG
  449.     WriteToLogFile "Old Ini Value in " + WINDIR$ + inicur$ + ": [" + section$ + "], " + keycur$ + " = " + keyval$ + " -->"
  450. '$endif ''DEBUG
  451.          
  452.                   keyval$ = SubVariables( keyval$ )
  453.                   CreateIniKeyValue WINDIR$ + inicur$, section$, keycur$, keyval$, cmoOverwrite
  454.  
  455.                   END IF
  456.                 keycount% = keycount% + 1
  457.                 keycur$ = GetNthFieldFromIniString( inikeys$, keycount% )
  458.                 WEND
  459.                 
  460.             END IF
  461.             
  462.                 index% = index% + 1
  463.                 inikeys$ = GetIniKeyString( Ini$, INFO$, inicur$+Str$(index%) )
  464.             
  465.         WEND
  466.  
  467.         count% = count% + 1
  468.         inicur$ = GetNthFieldFromIniString( INIFILES$, count% )
  469.     WEND
  470.  
  471. END IF
  472.  
  473. ''**************************
  474. '' Add Program Item
  475. ''**************************
  476.  
  477.     IF ADDGROUP$ = "ON" THEN
  478.  
  479.        IF  INSMODE$ = "NETWORK" THEN
  480.             ExeDir$ = SOURCE$
  481.         ELSE
  482.             ExeDir$ = DEST$
  483.        END IF
  484.        
  485.     CreateProgmanGroup NEWGROUP$, "", cmoNone
  486.     ShowProgmanGroup  NEWGROUP$, 1, cmoNone
  487.  
  488.     count% = 1
  489.     program$ = GetNthFieldFromIniString( ITEMEXE$, count% )
  490.     
  491.            WHILE program$ <> ""
  492.  
  493.         command$  = GetIniKeyString( Ini$, INFO$, program$ )
  494.         itemname$ = GetNthFieldFromIniString( command$, 1 )
  495.         option$   = GetNthFieldFromIniString( command$, 2 )
  496.                 iconname$ = GetNthFieldFromIniString( command$, 3 )
  497.  
  498.             IF iconname$ <> "" THEN
  499.                 iconidx$  = GetNthFieldFromIniString( command$, 4 )
  500.  
  501.                 IF iconidx$ <> "" THEN
  502.                     iconname$ = iconname$ + "," + iconidx$
  503.                     iconx$    = GetNthFieldFromIniString( command$, 5 )
  504.  
  505.                     IF iconx$ <> "" THEN
  506.                         iconname$ = iconname$ + "," + iconx$
  507.                         icony$    = GetNthFieldFromIniString( command$, 6 )
  508.  
  509.                         IF icony$ <> "" THEN
  510.                             iconname$ = iconname$ + "," + icony$
  511.                             workdir$  = GetNthFieldFromIniString( command$, 7 )
  512.  
  513.                             IF workdir$ <> "" THEN
  514.                                 iconname$ = iconname$ + "," + workdir$
  515.                             END IF
  516.                         END IF
  517.                     END IF
  518.                 END IF
  519.             END IF
  520.  
  521.             option$   = SubVariables( option$ )
  522.             iconname$ = SubVariables( iconname$ )
  523.             command$  = MakePath( ExeDir$, program$ ) + " " + option$
  524.  
  525. '$ifdef DEBUG
  526.             WriteToLogFile "Creating Program Item (Group,Name,Command):  " + NEWGROUP$ + ", " + itemname$ + ", " + command$
  527.             WriteToLogFile "Others: " + iconname$
  528. '$endif ''DEBUG
  529.  
  530.             CreateProgmanItem NEWGROUP$, itemname$, command$, iconname$, cmoOverwrite
  531.  
  532.         count% = count% + 1
  533.         program$ = GetNthFieldFromIniString( ITEMEXE$, count% )
  534.     WEND
  535.  
  536.     END IF
  537.  
  538. ''**************************
  539. '' Add Path
  540. ''**************************
  541.  
  542.     IF ADDPATH$ = "ON" THEN
  543.         GetLocalHardDrivesList "HardDrvs"
  544.         drv$ = GetListItem("HardDrvs", 1) + ":\"
  545.         IF DoesFileExist(drv$+"autoexec.bat", femExists ) THEN
  546.             PrependToPath drv$+"autoexec.bat", drv$+"autex.tmp", DEST$, cmoNone
  547.             RemoveFile drv$+"autoexec.old", cmoNone
  548.             BackupFile drv$+"autoexec.bat", "autoexec.old"
  549.             RenameFile drv$+"autex.tmp", "autoexec.bat"
  550.         END IF
  551.     END IF
  552.  
  553.  
  554. ''****************************************
  555. ''  Close Log file 
  556. ''****************************************
  557.  
  558. '$IFDEF DEBUG
  559.     CloseLogFile
  560. '$ENDIF
  561.  
  562. END SUB
  563.  
  564.  
  565.  
  566. '**
  567. '** Purpose:
  568. '**     Appends a file name to the end of a directory path,
  569. '**     inserting a backslash character as needed.
  570. '** Arguments:
  571. '**     szDir$  - full directory path (with optional ending "\")
  572. '**     szFile$ - filename to append to directory
  573. '** Returns:
  574. '**     Resulting fully qualified path name.
  575. '*************************************************************************
  576. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  577.     IF szDir$ = "" THEN
  578.         MakePath = szFile$
  579.     ELSEIF szFile$ = "" THEN
  580.         MakePath = szDir$
  581.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  582.         MakePath = szDir$ + szFile$
  583.     ELSE
  584.         MakePath = szDir$ + "\" + szFile$
  585.     END IF
  586. END FUNCTION
  587.  
  588. ''
  589. ''   Bastardised version of AddSectionFilesToCopyList
  590. ''   that does nothing if the section does not exist
  591. ''*************************************************************************
  592. SUB AddSectFilesToCopyList (szSect$, szSrc$, szDest$) STATIC
  593.     szInf$ = TEMPDIR$ + INF_FILE$
  594.  
  595. '$ifdef DEBUG
  596.     WriteToLogFile "AddSectFilesToCopyList: "+szSect$+", "+szSrc$+", "+szDest$+", "+szInf$
  597. '$endif ''DEBUG
  598.  
  599.     if DoesIniSectionExist( szInf$, szSect$) then
  600.         IF FAddSectionFilesToCopyList (szSect$, szSrc$, szDest$) = 0 THEN
  601.             ERROR STFERR
  602.         END IF
  603.     end if
  604. END SUB
  605.  
  606.  
  607.  
  608. ''***********************************************
  609. '' This function subsitutes pre-defined 
  610. '' variables with their run-time values
  611. ''***********************************************
  612.  
  613. FUNCTION SubVariables( szString$ ) STATIC AS STRING 
  614.  
  615.  
  616.     DIM pos%, lastpos%
  617.     DIM Temp$
  618.  
  619.     FOR I% = 0 TO VAR_MAX - 1 STEP 1
  620.  
  621.         lastpos% = 0
  622.         pos% = INSTR( 1, szString$, VarNames$( I% ) )
  623.             
  624.         WHILE pos% > lastpos% 
  625.  
  626.             lastpos% = Len( VarNames$( I% ) ) + pos% 
  627.             Temp$ = MID$( szString$, 1, pos% - 1 )
  628.             Temp$ = Temp$ + VarValues$( I% )
  629.             Temp$ = Temp$ + MID$( szString$, lastpos%, Len( szString$ ) - lastpos% + 1 )
  630.             lastpos% = pos% + Len( VarValues$( I% ) )
  631.             szString$  = Temp$
  632.             pos% = InStr( lastpos%, szString$, VarNames$( I% ) )
  633.             
  634.         WEND
  635.  
  636.  
  637.     NEXT I%
  638.  
  639.     SubVariables$ = szString$
  640.  
  641. END FUNCTION
  642. 
  643.